#pragma once

#include <IwGeomFVec2.h>

class OBB {
	
public:
	// pos is the center position of the box
	void SetUpCentered( CIwFVec2 pos, CIwFVec2 size, CIwFVec2 orientation );
	void UpdateTransform( CIwFVec2 pos, CIwFVec2 orientation );
	
#ifdef _DEBUG
	void DrawDebug();
#endif

	// return true if the box overlaps the line
	bool CheckLeftScreenBorderIntersection() const;
	bool CheckRightScreenBorderIntersection() const;
	bool CheckTopScreenBorderIntersection() const;
	bool CheckBottomScreenBorderIntersection() const;

	// returns true of the boxes are overlapping
	static bool CheckForOverlapOBB( const OBB &o1, const OBB &o2 );
	
	static bool CheckForOverlapLines( const OBB &ship_obb, const CIwFVec2* points, int num_points , CIwFVec2 *normal );
	
private:

	CIwFVec2 m_size;
	CIwFVec2 m_pos;
	float m_radius_square;
	CIwFVec2 m_corners[4];
};